package net.dopan.pigframe.oss.service;

import net.dopan.pigframe.core.base.service.BaseService;
import net.dopan.pigframe.core.utils.SysConfigConstant;
import net.dopan.pigframe.oss.model.entity.OSSConfig;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

/**
 * @Package: net.dopan.pigframe.oss.service
 * @Title: OSSConfigService
 * @Description: OSS配置信息
 * @author: 刘宽
 * @date: 2018/8/8 14:41
 */
@CacheConfig(cacheNames = SysConfigConstant.CLOUD_STORAGE_OSS_CONFIG)
public interface OSSConfigService extends BaseService<OSSConfig> {

	/**
	 * 根据key，更新value
	 * @param key
	 * @param value
	 * @param id
	 */
	@Cacheable(key = "#key")
	public void updateValueByKey(String key, String value, Integer id);

	/**
	 * 根据key，获取配置的value值
	 * @param key
	 * @return
	 */
	@Cacheable(key = "#key")
	public String getValue(String key);

	/**
	 * 根据key，获取value的Object对象
	 * @param key
	 * @param clazz
	 * @param <T>
	 * @return
	 */
	@Cacheable(key = "#key")
	public <T> T getConfigObject(String key, Class<T> clazz);
	
}
